#ifndef _ARRAYACCESS_
#define _ARRAYACCESS_

#include "Expression.h"

class ArrayAccess: public Expression
{
public:
    ArrayAccess(TreeNode* iSource, TreeNode* iIndexExpression);
    virtual ~ArrayAccess();
    virtual void CheckVariables(set<string>& oVariables, string iParentName);
    virtual void CheckExpressionTypes(map<string, ExpressionType*>& iVarTypes, string iParentName);
    virtual ExpressionType* GetType(map<string, ExpressionType*>& iVarTypes, string iParentName);
    virtual void Accept(GeneralVisitor*);
    virtual bool IsArrayAccess() { return true; }

    TreeNode* GetArrayRef()         { return fSource;           }
    TreeNode* GetIndexExpression()  { return fIndexExpression;  }

private:
    TreeNode* fSource;
    TreeNode* fIndexExpression;
};

#endif
